.TH FSCK 8
.SH NAME
fsck \- perform filesystem consistency check
.SH SYNOPSIS
\fBfsck\fR [\fB\-aflrsvw\fR]\fR [\fIdevice\fR] ...\fR
.br
.SH OPTIONS
.TP 5
.B \-a
List and automatically repair inconsistencies
.TP 5
.B \-f
Force filesystem check
.TP 5
.B \-l
List the files and directories in the filesystem
.TP 5
.B \-r
Prompt user for repairs if inconsistencies are found
.TP 5
.B \-s
List the superblock of the filesystem
.TP 5
.B \-v
Display filesystem summary. When used with -l, displays inode number, mode and link count.
.TP 5
.B \-vv
When used with -l, displays inode size, uid/gid and nonzero Z map blocks.
.TP 5
.B \-vvv
When used with -l, displays inode size, uid/gid and all Z map blocks.
.TP 5
.B \-w
Warn about inodes that can't be cleared
.SH EXAMPLES
.TP 25
.B fsck /dev/hda1
# Check filesystem on \fI/dev/hda1\fR
.TP 25
.B fsck \-a /dev/fd1
# Automatically fix errors on \fI/dev/fd1\fR
.TP 25
.B fsck \-l /dev/fd0
# List the contents of \fI/dev/fd0\fR
.TP 25
.B fsck \-c 2 3 /dev/hda2
# Check and list \fI/dev/hda2\fR i-nodes 2 & 3
.SH DESCRIPTION
.PP
\fIFsck\fR performs consistency checks on the filesystems which reside 
on the specified devices. Without options,
.IR fsck
checks and reports but makes noe changes.
When either the \fB\-a\fR or \fB\-r\fR flags are given, the filesystem
will be repaired if errors are found. In the absence of the \fB\-a\fR flag, the user will be prompted for
every error found. Entering a newline (or a 'y') means 'yes', 'n' means 'no' and 'a' means 'activate automatic mode'
and \fIfsck\fR will continue as if the \fB\-a\fR flag was present: Fix errors without asking. Responses
are case-insensitive.
.PP
When a filesystem is unmounted cleanly, its superblock is marked as such and 
.IR fsck
will simply report that the filesystem is clean and exit. 
A complete check may still be performed by specifying the
\fR\-f\fR option.
.PP
The normal case is for 
.IR fsck
to run silently. If no errors are found, it just exits. Adding the \fR\-v\fR option activates verbose mode 
and 
.IR fsck
will report statisics about the filesystem.
.PP
Before running \fIfsck\fR on a mounted filesystem, it must first be unmounted.
Trying to repair a mounted filesystem is dangerous and should not be 
attempted.
.PP
To repair the root filesystem (which cannot be unmounted), first 
kill any and all processes. 
Type \fIsync\fR to force any buffered changes to disk,
run \fIfsck\fR on the root filesystem and immediately reboot the
computer by typing \fIreboot\fR.
.PP
It is necessary to kill all processes before repairing the root filesystem
to prevent them from modifying any disk blocks while \fIfsck\fR is running.
This is only necessary for the root filesystem, any other filesystem can
simply be unmounted before it is checked.
.SH BUGS
.IR fsck
needs significant amounts of memory to run and may fail with a 'no memory' error if the system is short on memory. It is advisable to run
.IR fsck
early in the system startupå process in order to avoid such problems.
.PP
.IR fsck
works with minix version 1 filesystems only. The maximum supported filesystem size is 64MB.
.SH "SEE ALSO"
.BR mkfs (8),
.BR mount (8).
